package br.com.educa.service;

import java.util.List;

import org.springframework.roo.addon.layers.service.RooService;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;

import br.com.educa.modelo.security.Menu;

@RooService(domainTypes = { br.com.educa.modelo.security.Menu.class })
public interface MenuService {

	public abstract long countAllMenus();

	@PreAuthorize("hasPermission(#post, 'WRITE')")
	public abstract void deleteMenu(Menu menu);

	@PostAuthorize("hasPermission(returnObject, 'WRITE')")
	public abstract Menu findMenu(Long id);

	@PostFilter("hasPermission(filterObject, 'READ')")
	public abstract List<Menu> findAllMenus();

	@PostFilter("hasPermission(filterObject, 'READ')")
	public abstract List<Menu> findAllMenusChildren(Menu pai);

	@PostFilter("hasPermission(filterObject, 'READ')")
	public abstract List<Menu> findMenuEntries(int firstResult, int maxResults);

	public abstract void saveMenu(Menu menu);

	@PreAuthorize("hasPermission(#post, 'WRITE')")
	public abstract Menu updateMenu(Menu menu);

}
